package o;

import android.content.Context;
import android.content.Intent;
import android.content.res.ColorStateList;
import android.graphics.PorterDuff.Mode;
import android.graphics.drawable.Drawable;
import android.util.Log;
import android.view.ActionProvider;
import android.view.CollapsibleActionView;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.MenuItem;
import android.view.MenuItem.OnActionExpandListener;
import android.view.MenuItem.OnMenuItemClickListener;
import android.view.SubMenu;
import android.view.View;
import android.widget.FrameLayout;
import androidx.annotation.RestrictTo;
import java.lang.reflect.Method;

@RestrictTo({androidx.annotation.RestrictTo.d.LIBRARY_GROUP})
public class bi extends bf<gk> implements MenuItem {
    private Method ˋ;

    class a extends hd {
        final /* synthetic */ bi ˊ;
        final ActionProvider ˎ;

        public a(bi biVar, Context context, ActionProvider actionProvider) {
            this.ˊ = biVar;
            super(context);
            this.ˎ = actionProvider;
        }

        public View ˏ() {
            return this.ˎ.onCreateActionView();
        }

        public boolean ˊ() {
            return this.ˎ.onPerformDefaultAction();
        }

        public boolean ॱ() {
            return this.ˎ.hasSubMenu();
        }

        public void ˎ(SubMenu subMenu) {
            this.ˎ.onPrepareSubMenu(this.ˊ.ˏ(subMenu));
        }
    }

    static class c extends FrameLayout implements at {
        final CollapsibleActionView ˏ;

        c(View view) {
            super(view.getContext());
            this.ˏ = (CollapsibleActionView) view;
            addView(view);
        }

        public void ˊ() {
            this.ˏ.onActionViewExpanded();
        }

        public void ˎ() {
            this.ˏ.onActionViewCollapsed();
        }

        View ॱ() {
            return (View) this.ˏ;
        }
    }

    class d extends bh<OnMenuItemClickListener> implements OnMenuItemClickListener {
        final /* synthetic */ bi ˋ;

        d(bi biVar, OnMenuItemClickListener onMenuItemClickListener) {
            this.ˋ = biVar;
            super(onMenuItemClickListener);
        }

        public boolean onMenuItemClick(MenuItem menuItem) {
            return ((OnMenuItemClickListener) this.ˎ).onMenuItemClick(this.ˋ.ˎ(menuItem));
        }
    }

    class e extends bh<OnActionExpandListener> implements OnActionExpandListener {
        final /* synthetic */ bi ˏ;

        e(bi biVar, OnActionExpandListener onActionExpandListener) {
            this.ˏ = biVar;
            super(onActionExpandListener);
        }

        public boolean onMenuItemActionExpand(MenuItem menuItem) {
            return ((OnActionExpandListener) this.ˎ).onMenuItemActionExpand(this.ˏ.ˎ(menuItem));
        }

        public boolean onMenuItemActionCollapse(MenuItem menuItem) {
            return ((OnActionExpandListener) this.ˎ).onMenuItemActionCollapse(this.ˏ.ˎ(menuItem));
        }
    }

    bi(Context context, gk gkVar) {
        super(context, gkVar);
    }

    public int getItemId() {
        return ((gk) this.ˎ).getItemId();
    }

    public int getGroupId() {
        return ((gk) this.ˎ).getGroupId();
    }

    public int getOrder() {
        return ((gk) this.ˎ).getOrder();
    }

    public MenuItem setTitle(CharSequence charSequence) {
        ((gk) this.ˎ).setTitle(charSequence);
        return this;
    }

    public MenuItem setTitle(int i) {
        ((gk) this.ˎ).setTitle(i);
        return this;
    }

    public CharSequence getTitle() {
        return ((gk) this.ˎ).getTitle();
    }

    public MenuItem setTitleCondensed(CharSequence charSequence) {
        ((gk) this.ˎ).setTitleCondensed(charSequence);
        return this;
    }

    public CharSequence getTitleCondensed() {
        return ((gk) this.ˎ).getTitleCondensed();
    }

    public MenuItem setIcon(Drawable drawable) {
        ((gk) this.ˎ).setIcon(drawable);
        return this;
    }

    public MenuItem setIcon(int i) {
        ((gk) this.ˎ).setIcon(i);
        return this;
    }

    public Drawable getIcon() {
        return ((gk) this.ˎ).getIcon();
    }

    public MenuItem setIntent(Intent intent) {
        ((gk) this.ˎ).setIntent(intent);
        return this;
    }

    public Intent getIntent() {
        return ((gk) this.ˎ).getIntent();
    }

    public MenuItem setShortcut(char c, char c2) {
        ((gk) this.ˎ).setShortcut(c, c2);
        return this;
    }

    public MenuItem setShortcut(char c, char c2, int i, int i2) {
        ((gk) this.ˎ).setShortcut(c, c2, i, i2);
        return this;
    }

    public MenuItem setNumericShortcut(char c) {
        ((gk) this.ˎ).setNumericShortcut(c);
        return this;
    }

    public MenuItem setNumericShortcut(char c, int i) {
        ((gk) this.ˎ).setNumericShortcut(c, i);
        return this;
    }

    public char getNumericShortcut() {
        return ((gk) this.ˎ).getNumericShortcut();
    }

    public int getNumericModifiers() {
        return ((gk) this.ˎ).getNumericModifiers();
    }

    public MenuItem setAlphabeticShortcut(char c) {
        ((gk) this.ˎ).setAlphabeticShortcut(c);
        return this;
    }

    public MenuItem setAlphabeticShortcut(char c, int i) {
        ((gk) this.ˎ).setAlphabeticShortcut(c, i);
        return this;
    }

    public char getAlphabeticShortcut() {
        return ((gk) this.ˎ).getAlphabeticShortcut();
    }

    public int getAlphabeticModifiers() {
        return ((gk) this.ˎ).getAlphabeticModifiers();
    }

    public MenuItem setCheckable(boolean z) {
        ((gk) this.ˎ).setCheckable(z);
        return this;
    }

    public boolean isCheckable() {
        return ((gk) this.ˎ).isCheckable();
    }

    public MenuItem setChecked(boolean z) {
        ((gk) this.ˎ).setChecked(z);
        return this;
    }

    public boolean isChecked() {
        return ((gk) this.ˎ).isChecked();
    }

    public MenuItem setVisible(boolean z) {
        return ((gk) this.ˎ).setVisible(z);
    }

    public boolean isVisible() {
        return ((gk) this.ˎ).isVisible();
    }

    public MenuItem setEnabled(boolean z) {
        ((gk) this.ˎ).setEnabled(z);
        return this;
    }

    public boolean isEnabled() {
        return ((gk) this.ˎ).isEnabled();
    }

    public boolean hasSubMenu() {
        return ((gk) this.ˎ).hasSubMenu();
    }

    public SubMenu getSubMenu() {
        return ˏ(((gk) this.ˎ).getSubMenu());
    }

    public MenuItem setOnMenuItemClickListener(OnMenuItemClickListener onMenuItemClickListener) {
        ((gk) this.ˎ).setOnMenuItemClickListener(onMenuItemClickListener != null ? new d(this, onMenuItemClickListener) : null);
        return this;
    }

    public ContextMenuInfo getMenuInfo() {
        return ((gk) this.ˎ).getMenuInfo();
    }

    public void setShowAsAction(int i) {
        ((gk) this.ˎ).setShowAsAction(i);
    }

    public MenuItem setShowAsActionFlags(int i) {
        ((gk) this.ˎ).setShowAsActionFlags(i);
        return this;
    }

    public MenuItem setActionView(View view) {
        if (view instanceof CollapsibleActionView) {
            view = new c(view);
        }
        ((gk) this.ˎ).setActionView(view);
        return this;
    }

    public MenuItem setActionView(int i) {
        ((gk) this.ˎ).setActionView(i);
        View actionView = ((gk) this.ˎ).getActionView();
        if (actionView instanceof CollapsibleActionView) {
            ((gk) this.ˎ).setActionView(new c(actionView));
        }
        return this;
    }

    public View getActionView() {
        View actionView = ((gk) this.ˎ).getActionView();
        if (actionView instanceof c) {
            return ((c) actionView).ॱ();
        }
        return actionView;
    }

    public MenuItem setActionProvider(ActionProvider actionProvider) {
        ((gk) this.ˎ).ˎ(actionProvider != null ? ˊ(actionProvider) : null);
        return this;
    }

    public ActionProvider getActionProvider() {
        hd ˋ = ((gk) this.ˎ).ˋ();
        if (ˋ instanceof a) {
            return ((a) ˋ).ˎ;
        }
        return null;
    }

    public boolean expandActionView() {
        return ((gk) this.ˎ).expandActionView();
    }

    public boolean collapseActionView() {
        return ((gk) this.ˎ).collapseActionView();
    }

    public boolean isActionViewExpanded() {
        return ((gk) this.ˎ).isActionViewExpanded();
    }

    public MenuItem setOnActionExpandListener(OnActionExpandListener onActionExpandListener) {
        ((gk) this.ˎ).setOnActionExpandListener(onActionExpandListener != null ? new e(this, onActionExpandListener) : null);
        return this;
    }

    public MenuItem setContentDescription(CharSequence charSequence) {
        ((gk) this.ˎ).ˎ(charSequence);
        return this;
    }

    public CharSequence getContentDescription() {
        return ((gk) this.ˎ).getContentDescription();
    }

    public MenuItem setTooltipText(CharSequence charSequence) {
        ((gk) this.ˎ).ˊ(charSequence);
        return this;
    }

    public CharSequence getTooltipText() {
        return ((gk) this.ˎ).getTooltipText();
    }

    public MenuItem setIconTintList(ColorStateList colorStateList) {
        ((gk) this.ˎ).setIconTintList(colorStateList);
        return this;
    }

    public ColorStateList getIconTintList() {
        return ((gk) this.ˎ).getIconTintList();
    }

    public MenuItem setIconTintMode(Mode mode) {
        ((gk) this.ˎ).setIconTintMode(mode);
        return this;
    }

    public Mode getIconTintMode() {
        return ((gk) this.ˎ).getIconTintMode();
    }

    public void ˏ(boolean z) {
        try {
            if (this.ˋ == null) {
                this.ˋ = ((gk) this.ˎ).getClass().getDeclaredMethod("setExclusiveCheckable", new Class[]{Boolean.TYPE});
            }
            this.ˋ.invoke(this.ˎ, new Object[]{Boolean.valueOf(z)});
        } catch (Throwable e) {
            Log.w("MenuItemWrapper", "Error while calling setExclusiveCheckable", e);
        }
    }

    a ˊ(ActionProvider actionProvider) {
        return new a(this, this.ˊ, actionProvider);
    }
}
